package com.lichuang.dedao.curriculum.service.impl;

import com.lichuang.dedao.curriculum.entity.CurriculumSection;
import com.lichuang.dedao.curriculum.mapper.CurriculumSectionMapper;
import com.lichuang.dedao.curriculum.service.ICurriculumSectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiaosong
 * @since 2019-07-18
 */
@Service
public class CurriculumSectionServiceImpl extends ServiceImpl<CurriculumSectionMapper, CurriculumSection> implements ICurriculumSectionService {

    @Autowired
    private CurriculumSectionMapper curriculumSectionMapper;

    @Override
    public List<CurriculumSection> getSectionByChapterId(Integer chapterId) {
        return curriculumSectionMapper.getSectionByChapterId(chapterId);
    }

    @Override
    public Integer updateSectionStatusById(Integer id,Integer status) {
        CurriculumSection curriculumSection = new CurriculumSection();
        curriculumSection.setState(status);
        curriculumSection.setId(id);
        return curriculumSectionMapper.updateById(curriculumSection);
    }

}
